import time
from multiprocessing.dummy import Pool
#使用线程池方式执行

start_time = time.time()
def get_page(str):
    print("正在下载：",str)
    time.sleep(2)
    print('下载成功：',str)

name_list = ['A','B','C','D']

#实例化一个线程池对象
pool = Pool(4)
#讲列表中每一个列表元素传递给get_page进行处理
pool.map(get_page,name_list)

end_time = time.time()
print((end_time-start_time),"秒")
